package study.thread.collection;

import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;

import javax.management.Query;

public class QueueTest {
	
	public static void main(String[] args) {
		
		Queue<String> queue = new LinkedList<String>();
		
		queue.offer("One");
		queue.offer("Two");
		queue.offer("Three");
		queue.offer("Four");
		
		System.out.println("Head of the Queue is : "+queue.poll());
		
		//PriorityQueue维护一个有序列表，加入到Queue中的元素会按它们的天然排序(通过其java.util.Comparable实现)
		//或者根据传递给构造函数的java.util.Comparator实现来定位
		Queue<String> queue2 = new PriorityQueue<String>();
		queue2.offer("One");
		queue2.offer("Two");
		queue2.offer("Three");
		queue2.offer("Four");
		
		System.out.println("Head of the Queue is : "+queue2.poll());
		
	}
}
